<%
var headContent = {
include("/pages/template/head.html"){}
%>

<script type="text/javascript">
    var oper;
    jQuery(function($) {
        // 页面方法
        oper = {
            width : 450,
            height : 500,
            form : document.form1,
            list : function() {
                var url = 'system/productvas/list';
                this.form.action = url;
                this.form.submit();
            },
            view : function(id) {
                var url = 'system/productvas/view/'+id;
                var title = '查看平台产品';
                Iframe(url, this.width, this.height, title, false, false, false, EmptyFunc);
            },
            add : function() {
                var url = 'system/productvas/add';
                var title = '添加平台产品';
                Iframe(url, this.width, this.height, title);
            },
            edit : function(id) {
                var url = 'system/productvas/edit/'+id;
                var title = '修改平台产品';
                Iframe(url, this.width, this.height, title);
            },
            del : function(id) {
                var url = 'system/productvas/delete/'+id;
                var title = '确认要删除该产品信息？';
                Confirm(title, function() {
                    form1.action = url;
                    form1.submit();
                });
            },
            bindProductinfo : function(id,operatorType,size) {
                var url = 'system/productvas/bindProductinfo?id='+id+'&size='+size+'&operatorType='+operatorType;
                var title = '关联供应商产品';
                Iframe(url, 700, this.height, title);
            }
        };
        //显示Menu索引
        showMenu('page_system');
        showMenu('page_productvas');
    });

    //分页
    var paginator = function(page) {
        oper.list();
    };

</script>

<%
};

var bodyContent = {
%>
<form name="form1" action="" method="post"  class="form-inline" role="form">
	<!-- 菜单 -->
	<% include("/pages/template/menu.html"){} %>

	<div class="tableSearch">
		<%  //查询列表 %>
		<div class="form-group">
			<input class="form-control" type="text" name="attr.ids" value="${attr.ids!''}"
				   placeholder="请输入产品ID" required='required' />
		</div>
		<div class="form-group">
			<input class="form-control" type="text" name="attr.vasProdName" value="${attr.vasProdName!''}"
				   placeholder="请输入产品名称"  />
		</div>


		<button type="button" class="btn btn-default" onclick="oper.list();" name="search">
			<span class="glyphicon glyphicon-search"></span> 查 询
		</button>
		<button type="button" class="btn btn-default" onclick="resetForm();">
			<span class="glyphicon glyphicon-refresh"></span> 重 置
		</button>
		<button type="button" class="btn btn-default" onclick="oper.add();">
			<span class="glyphicon glyphicon-plus"></span> 新 增
		</button>
	</div>

	<!-- 数据列表 -->
	<table class="table table-striped table-bordered table-hover">
		<thead>
		<tr>
			<th>序号</th>
			<%  // 列表头部 %>
			<th name="ids" class="sorting">平台产品ID</th>
			<th name="vasProdName" class="sorting">平台产品名称</th>
			<th name="operatorType" class="sorting">运营商</th>
			<th name="productPrice" class="sorting">国内价格(元)</th>
			<th name="productSize" class="sorting">颗粒度</th>
			<th name="status" >状态</th>
			<th name="deploys" >已关联</th>
			<th name="deployCount" >合计</th>
			<th style = "width:25%">操作</th>
		</tr>
		</thead>
		<tbody>
		<% for(item in page.list){ %>
		<tr >
			<td>${itemLP.index }</td>
			<%  // 列表内容 %>
			<td>${item.ids}</td>
			<td>${item.vasProdName}</td>
			<td>
				<% if(item.operatorType=="1") { %>
				电信
				<%	} %>
				<% if(item.operatorType=="2") { %>
				移动
				<%	} %>
				<% if(item.operatorType=="3") { %>
				联通
				<%	} %>
			</td>
			<td>${item.productPrice}</td>
			<td>${item.productSize}</td>
			<td>
				<% if(item.status=="1") { %>
				<span class ="font-danger">失效</span>
				<%	} %>
				<% if(item.status=="0") { %>
				<span class ="font-success">有效</span>
				<%	} %>
			</td>
			<td>${item.deploys ==null?"未关联供应商产品":item.deploys}</td>
			<td>${item.deployCount}</td>
			<td>
				<a href="javascript:void(0);" class="btn btn-sm btn-success" onclick="oper.view('${item.ids}');">查看</a>
				<a href="javascript:void(0);" class="btn btn-sm btn-primary" onclick="oper.edit('${item.ids}');">修改</a>
				<a href="javascript:void(0);" title="该操作将删除当前产品以及关联的供应商产品" class="btn btn-sm btn-danger" onclick="oper.del('${item.ids}');">删除</a>
				<a href="javascript:void(0);" class="btn btn-sm btn-primary" onclick="oper.bindProductinfo('${item.ids}','${item.operatorType}','${item.productSize}');">关联供应商产品</a>
			</td>
		</tr>
		<% } %>
		</tbody>
	</table>
	<%include("/pages/includes/paginator.html"){} %>
</form>
<%}; %>


<% layout("/pages/template/_layout.html",{head:headContent,body:bodyContent}){ %>
<%} %>